<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<title>Adjective Meanings</title>
<link href="../docs-assets/Breadcrumbs.css" rel="stylesheet" rev="stylesheet" type="text/css">
		<meta name="viewport" content="width=device-width initial-scale=1">
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<meta http-equiv="Content-Language" content="en-gb">

<link href="../docs-assets/Contents.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Progress.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Navigation.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Fonts.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Base.css" rel="stylesheet" rev="stylesheet" type="text/css">
<script>
function togglePopup(material_id) {
  var popup = document.getElementById(material_id);
  popup.classList.toggle("show");
}
</script>

<link href="../docs-assets/Popups.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Colours.css" rel="stylesheet" rev="stylesheet" type="text/css">
		
	</head>
	<body class="commentary-font">
		<nav role="navigation">
		<h1><a href="../index.html"><img src="../docs-assets/Inform.png" height=72> </a></h1>
<ul><li><a href="../index.html">home</a></li>
</ul><h2>Compiler</h2><ul>
<li><a href="../structure.html">structure</a></li>
<li><a href="../inbuildn.html">inbuild</a></li>
<li><a href="../inform7n.html">inform7</a></li>
<li><a href="../intern.html">inter</a></li>
<li><a href="../services.html">services</a></li>
<li><a href="../secrets.html">secrets</a></li>
</ul><h2>Other Tools</h2><ul>
<li><a href="../inblorbn.html">inblorb</a></li>
<li><a href="../inform6.html">inform6</a></li>
<li><a href="../inpolicyn.html">inpolicy</a></li>
</ul><h2>Resources</h2><ul>
<li><a href="../extensions.html">extensions</a></li>
<li><a href="../kits.html">kits</a></li>
</ul><h2>Repository</h2><ul>
<li><a href="https://github.com/ganelson/inform"><img src="../docs-assets/github.png" height=0> github</a></li>
</ul><h2>Related Projects</h2><ul>
<li><a href="https://github.com/ganelson/inweb"><img src="../docs-assets/github.png" height=0> inweb</a></li>
<li><a href="https://github.com/ganelson/intest"><img src="../docs-assets/github.png" height=0> intest</a></li>
</ul>
		</nav>
		<main role="main">
		<!-- Weave of 'Adjective Meanings' generated by inweb -->
<div class="breadcrumbs">
    <ul class="crumbs"><li><a href="../index.html">Home</a></li><li><a href="../inform7n.html">Inform7</a></li><li><a href="index.html">assertions</a></li><li><a href="index.html#8">Chapter 8: Predicates</a></li><li><b>Adjective Meanings</b></li></ul></div>
<p class="purpose">One individual meaning which an adjective can have.</p>

<ul class="toc"><li><a href="8-am.html#SP1">&#167;1. Meanings</a></li><li><a href="8-am.html#SP4">&#167;4. Task data</a></li><li><a href="8-am.html#SP8">&#167;8. Families of adjective meanings</a></li></ul><hr class="tocbar">

<p class="commentary firstcommentary"><a id="SP1" class="paragraph-anchor"></a><b>&#167;1. Meanings.</b>For example, "odd" in the sense of numbers is a single meaning. Each meaning
is an instance of:
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">typedef</span><span class="plain-syntax"> </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">adjective_meaning</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">adjective</span><span class="plain-syntax"> *</span><span class="identifier-syntax">owning_adjective</span><span class="plain-syntax">; </span><span class="comment-syntax"> of which this is a meaning</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">adjective_domain_data</span><span class="plain-syntax"> </span><span class="identifier-syntax">domain</span><span class="plain-syntax">; </span><span class="comment-syntax"> to what can this meaning be applied?</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">adjective_meaning_family</span><span class="plain-syntax"> *</span><span class="identifier-syntax">family</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">general_pointer</span><span class="plain-syntax"> </span><span class="identifier-syntax">family_specific_data</span><span class="plain-syntax">; </span><span class="comment-syntax"> to the relevant structure</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">adjective_meaning</span><span class="plain-syntax"> *</span><span class="identifier-syntax">negated_from</span><span class="plain-syntax">; </span><span class="comment-syntax"> if explicitly constructed as such</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">wording</span><span class="plain-syntax"> </span><span class="identifier-syntax">indexing_text</span><span class="plain-syntax">; </span><span class="comment-syntax"> text to use in the Phrasebook index</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">parse_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">defined_at</span><span class="plain-syntax">; </span><span class="comment-syntax"> from what sentence this came (if it did)</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">schemas_prepared</span><span class="plain-syntax">; </span><span class="comment-syntax"> have schemas been prepared yet?</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">adjective_task_data</span><span class="plain-syntax"> </span><span class="identifier-syntax">task_data</span><span class="plain-syntax">[</span><span class="identifier-syntax">NO_ATOM_TASKS</span><span class="plain-syntax"> + </span><span class="constant-syntax">1</span><span class="plain-syntax">]; </span><span class="comment-syntax"> see below</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">has_been_compiled_in_support_function</span><span class="plain-syntax">; </span><span class="comment-syntax"> which may never happen</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">CLASS_DEFINITION</span>
<span class="plain-syntax">} </span><span class="reserved-syntax">adjective_meaning</span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>The structure adjective_meaning is accessed in 3/nrr, 5/id, 5/idf, 5/adf, 5/tpf, 5/rf, 8/tap, 8/tcp, 8/aa, 8/amd, 8/abp, 8/abif and here.</li></ul>
<p class="commentary firstcommentary"><a id="SP2" class="paragraph-anchor"></a><b>&#167;2. </b>This can be created in two ways: straightforwardly &mdash;
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">adjective_meaning</span><span class="plain-syntax"> *</span><span class="function-syntax">AdjectiveMeanings::new</span><button class="popup" onclick="togglePopup('usagePopup1')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup1">Usage of <span class="code-font"><span class="function-syntax">AdjectiveMeanings::new</span></span>:<br/>Adjectives by Phrase - <a href="8-abp.html#SP1">&#167;1</a><br/>Adjectives by Condition - <a href="8-abc.html#SP2">&#167;2</a><br/>Adjectives by Inter Function - <a href="8-abif.html#SP2">&#167;2</a><br/>Adjectives by Inter Condition - <a href="8-abic.html#SP2">&#167;2</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">adjective_meaning_family</span><span class="plain-syntax"> *</span><span class="identifier-syntax">family</span><span class="plain-syntax">,</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">general_pointer</span><span class="plain-syntax"> </span><span class="identifier-syntax">details</span><span class="plain-syntax">, </span><span class="identifier-syntax">wording</span><span class="plain-syntax"> </span><span class="identifier-syntax">W</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">adjective_meaning</span><span class="plain-syntax"> *</span><span class="identifier-syntax">am</span><span class="plain-syntax"> = </span><span class="identifier-syntax">CREATE</span><span class="plain-syntax">(</span><span class="reserved-syntax">adjective_meaning</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">am</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">defined_at</span><span class="plain-syntax"> = </span><span class="identifier-syntax">current_sentence</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">am</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">indexing_text</span><span class="plain-syntax"> = </span><span class="identifier-syntax">W</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">am</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">owning_adjective</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">am</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">domain</span><span class="plain-syntax"> = </span><a href="8-amd.html#SP2" class="function-link"><span class="function-syntax">AdjectiveMeaningDomains::new_from_text</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">EMPTY_WORDING</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">am</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">family</span><span class="plain-syntax"> = </span><span class="identifier-syntax">family</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">am</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">family_specific_data</span><span class="plain-syntax"> = </span><span class="identifier-syntax">details</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">am</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">has_been_compiled_in_support_function</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">am</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">schemas_prepared</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">am</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">negated_from</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><a href="8-am.html#SP5" class="function-link"><span class="function-syntax">AdjectiveMeanings::initialise_all_task_data</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">am</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">am</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP3" class="paragraph-anchor"></a><b>&#167;3. </b>Or as the logical negation of an existing meaning (thus, "odd" for numbers
might be created as the negation of "even" for numbers):
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">adjective_meaning</span><span class="plain-syntax"> *</span><span class="function-syntax">AdjectiveMeanings::negate</span><button class="popup" onclick="togglePopup('usagePopup2')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup2">Usage of <span class="code-font"><span class="function-syntax">AdjectiveMeanings::negate</span></span>:<br/>Adjectival Definition Family - <a href="5-adf.html#SP9_3">&#167;9.3</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">adjective_meaning</span><span class="plain-syntax"> *</span><span class="identifier-syntax">other</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">other</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">negated_from</span><span class="plain-syntax">) </span><span class="identifier-syntax">internal_error</span><span class="plain-syntax">(</span><span class="string-syntax">"cannot negate an already negated AM"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">adjective_meaning</span><span class="plain-syntax"> *</span><span class="identifier-syntax">am</span><span class="plain-syntax"> = </span><span class="identifier-syntax">CREATE</span><span class="plain-syntax">(</span><span class="reserved-syntax">adjective_meaning</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">am</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">defined_at</span><span class="plain-syntax"> = </span><span class="identifier-syntax">current_sentence</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">am</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">indexing_text</span><span class="plain-syntax"> = </span><span class="identifier-syntax">other</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">indexing_text</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">am</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">owning_adjective</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">am</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">domain</span><span class="plain-syntax"> = </span><span class="identifier-syntax">other</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">domain</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">am</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">family</span><span class="plain-syntax"> = </span><span class="identifier-syntax">other</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">family</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">am</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">family_specific_data</span><span class="plain-syntax"> = </span><span class="identifier-syntax">other</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">family_specific_data</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">am</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">has_been_compiled_in_support_function</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">am</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">schemas_prepared</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">am</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">negated_from</span><span class="plain-syntax"> = </span><span class="identifier-syntax">other</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><a href="8-am.html#SP5" class="function-link"><span class="function-syntax">AdjectiveMeanings::negate_task_data</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">am</span><span class="plain-syntax">, </span><span class="identifier-syntax">other</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax">=1; </span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;=</span><span class="identifier-syntax">NO_ATOM_TASKS</span><span class="plain-syntax">; </span><span class="identifier-syntax">i</span><span class="plain-syntax">++) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">j</span><span class="plain-syntax"> = </span><span class="identifier-syntax">i</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NOW_ATOM_TRUE_TASK</span><span class="plain-syntax">) </span><span class="identifier-syntax">j</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NOW_ATOM_FALSE_TASK</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NOW_ATOM_FALSE_TASK</span><span class="plain-syntax">) </span><span class="identifier-syntax">j</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NOW_ATOM_TRUE_TASK</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><a href="8-am.html#SP4" class="function-link"><span class="function-syntax">AdjectiveMeanings::copy_task_data</span></a><span class="plain-syntax">(&amp;(</span><span class="identifier-syntax">am</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">task_data</span><span class="plain-syntax">[</span><span class="identifier-syntax">j</span><span class="plain-syntax">]), &amp;(</span><span class="identifier-syntax">other</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">task_data</span><span class="plain-syntax">[</span><span class="identifier-syntax">i</span><span class="plain-syntax">]));</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">Calculus::Schemas::modify</span><span class="plain-syntax">(&amp;(</span><span class="identifier-syntax">am</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">task_data</span><span class="plain-syntax">[</span><span class="identifier-syntax">j</span><span class="plain-syntax">].</span><span class="element-syntax">call_to_support_function</span><span class="plain-syntax">), </span><span class="string-syntax">""</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">am</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP4" class="paragraph-anchor"></a><b>&#167;4. Task data.</b>When Inform needs to compile code for testing if an adjective is true as
applied to something, or to make it now true (or false), it does this by
compiling code for the associated unary predicate &mdash; see
<a href="8-tap.html" class="internal">The Adjectival Predicates</a>. What to compile depends on the meaning or
meanings which might apply; if it's this meaning, then we will need an
I6 schema to carry out one of three tasks, <span class="extract"><span class="extract-syntax">TEST_ATOM_TASK</span></span>,
<span class="extract"><span class="extract-syntax">NOW_ATOM_TRUE_TASK</span></span>, or <span class="extract"><span class="extract-syntax">NOW_ATOM_FALSE_TASK</span></span>.
</p>

<p class="commentary">A meaning has one of these for each of the possible tasks:
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">typedef</span><span class="plain-syntax"> </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">adjective_task_data</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">task_mode</span><span class="plain-syntax">; </span><span class="comment-syntax"> one of the </span><span class="extract"><span class="extract-syntax">*_TASKMODE</span></span><span class="comment-syntax"> constants: see below</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">i6_schema</span><span class="plain-syntax"> </span><span class="identifier-syntax">call_to_support_function</span><span class="plain-syntax">; </span><span class="comment-syntax"> where </span><span class="extract"><span class="extract-syntax">TRUE</span></span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">i6_schema</span><span class="plain-syntax"> </span><span class="identifier-syntax">code_to_perform</span><span class="plain-syntax">; </span><span class="comment-syntax"> where </span><span class="extract"><span class="extract-syntax">TRUE</span></span>
<span class="plain-syntax">} </span><span class="reserved-syntax">adjective_task_data</span><span class="plain-syntax">;</span>

<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">AdjectiveMeanings::initialise_task_data</span><button class="popup" onclick="togglePopup('usagePopup3')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup3">Usage of <span class="code-font"><span class="function-syntax">AdjectiveMeanings::initialise_task_data</span></span>:<br/><a href="8-am.html#SP5">&#167;5</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">adjective_task_data</span><span class="plain-syntax"> *</span><span class="identifier-syntax">atd</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">atd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">task_mode</span><span class="plain-syntax"> = </span><span class="constant-syntax">NO_TASKMODE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">Calculus::Schemas::modify</span><span class="plain-syntax">(&amp;(</span><span class="identifier-syntax">atd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">code_to_perform</span><span class="plain-syntax">), </span><span class="string-syntax">""</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">Calculus::Schemas::modify</span><span class="plain-syntax">(&amp;(</span><span class="identifier-syntax">atd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">call_to_support_function</span><span class="plain-syntax">), </span><span class="string-syntax">""</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">AdjectiveMeanings::copy_task_data</span><button class="popup" onclick="togglePopup('usagePopup4')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup4">Usage of <span class="code-font"><span class="function-syntax">AdjectiveMeanings::copy_task_data</span></span>:<br/><a href="8-am.html#SP3">&#167;3</a>, <a href="8-am.html#SP5">&#167;5</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">adjective_task_data</span><span class="plain-syntax"> *</span><span class="identifier-syntax">to</span><span class="plain-syntax">, </span><span class="reserved-syntax">adjective_task_data</span><span class="plain-syntax"> *</span><span class="identifier-syntax">from</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">to</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">task_mode</span><span class="plain-syntax"> = </span><span class="identifier-syntax">from</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">task_mode</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">to</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">code_to_perform</span><span class="plain-syntax"> = </span><span class="identifier-syntax">from</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">code_to_perform</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">to</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">call_to_support_function</span><span class="plain-syntax"> = </span><span class="identifier-syntax">from</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">call_to_support_function</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<ul class="endnotetexts"><li>The structure adjective_task_data is private to this section.</li></ul>
<p class="commentary firstcommentary"><a id="SP5" class="paragraph-anchor"></a><b>&#167;5. </b>These functions set up the task data for a new meaning. Note the transposition,
so that a negated meaning has the <span class="extract"><span class="extract-syntax">NOW_ATOM_TRUE_TASK</span></span> and <span class="extract"><span class="extract-syntax">NOW_ATOM_FALSE_TASK</span></span>
switched around from the original.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">AdjectiveMeanings::initialise_all_task_data</span><button class="popup" onclick="togglePopup('usagePopup5')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup5">Usage of <span class="code-font"><span class="function-syntax">AdjectiveMeanings::initialise_all_task_data</span></span>:<br/><a href="8-am.html#SP2">&#167;2</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">adjective_meaning</span><span class="plain-syntax"> *</span><span class="identifier-syntax">am</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax">=1; </span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;=</span><span class="identifier-syntax">NO_ATOM_TASKS</span><span class="plain-syntax">; </span><span class="identifier-syntax">i</span><span class="plain-syntax">++)</span>
<span class="plain-syntax">        </span><a href="8-am.html#SP4" class="function-link"><span class="function-syntax">AdjectiveMeanings::initialise_task_data</span></a><span class="plain-syntax">(&amp;(</span><span class="identifier-syntax">am</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">task_data</span><span class="plain-syntax">[</span><span class="identifier-syntax">i</span><span class="plain-syntax">]));</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">AdjectiveMeanings::negate_task_data</span><button class="popup" onclick="togglePopup('usagePopup6')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup6">Usage of <span class="code-font"><span class="function-syntax">AdjectiveMeanings::negate_task_data</span></span>:<br/><a href="8-am.html#SP3">&#167;3</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">adjective_meaning</span><span class="plain-syntax"> *</span><span class="identifier-syntax">am</span><span class="plain-syntax">, </span><span class="reserved-syntax">adjective_meaning</span><span class="plain-syntax"> *</span><span class="identifier-syntax">other</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax">=1; </span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;=</span><span class="identifier-syntax">NO_ATOM_TASKS</span><span class="plain-syntax">; </span><span class="identifier-syntax">i</span><span class="plain-syntax">++) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">j</span><span class="plain-syntax"> = </span><span class="identifier-syntax">i</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NOW_ATOM_TRUE_TASK</span><span class="plain-syntax">) </span><span class="identifier-syntax">j</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NOW_ATOM_FALSE_TASK</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NOW_ATOM_FALSE_TASK</span><span class="plain-syntax">) </span><span class="identifier-syntax">j</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NOW_ATOM_TRUE_TASK</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><a href="8-am.html#SP4" class="function-link"><span class="function-syntax">AdjectiveMeanings::copy_task_data</span></a><span class="plain-syntax">(&amp;(</span><span class="identifier-syntax">am</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">task_data</span><span class="plain-syntax">[</span><span class="identifier-syntax">j</span><span class="plain-syntax">]), &amp;(</span><span class="identifier-syntax">other</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">task_data</span><span class="plain-syntax">[</span><span class="identifier-syntax">i</span><span class="plain-syntax">]));</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">Calculus::Schemas::modify</span><span class="plain-syntax">(&amp;(</span><span class="identifier-syntax">am</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">task_data</span><span class="plain-syntax">[</span><span class="identifier-syntax">j</span><span class="plain-syntax">].</span><span class="element-syntax">call_to_support_function</span><span class="plain-syntax">), </span><span class="string-syntax">""</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP6" class="paragraph-anchor"></a><b>&#167;6. </b>The schema for a task generates code to perform it. There are three strategies:
</p>

<ul class="items"><li>&#9679; produce a problem message, saying this is impossible;
</li><li>&#9679; compile direct inline code;
</li><li>&#9679; compile a function call to a function, which actually performs the task;
</li></ul>
<p class="commentary">Those strategies correspond to the three <span class="extract"><span class="extract-syntax">*_TASKMODE</span></span> constants.
</p>

<p class="commentary">By default, an adjective meaning is unable to perform any of the three tasks,
and the creator of it has to call <a href="8-am.html#SP6" class="internal">AdjectiveMeanings::make_schema</a> to say
otherwise. This puts us by default into <span class="extract"><span class="extract-syntax">DIRECT_TASKMODE</span></span>, unless we're working
in the world of objects where run-time typechecking will be needed &mdash; in which
case <span class="extract"><span class="extract-syntax">VIA_SUPPORT_FUNCTION_TASKMODE</span></span>. But the creator can insist on the latter
anyway with a subsequent call to <a href="8-am.html#SP6" class="internal">AdjectiveMeanings::perform_task_via_function</a>.
</p>

<pre class="definitions code-font"><span class="definition-keyword">enum</span> <span class="constant-syntax">NO_TASKMODE</span><span class="plain-syntax"> </span><span class="identifier-syntax">from</span><span class="plain-syntax"> </span><span class="constant-syntax">1</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">DIRECT_TASKMODE</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">VIA_SUPPORT_FUNCTION_TASKMODE</span>
</pre>
<pre class="displayed-code all-displayed-code code-font">
<span class="identifier-syntax">i6_schema</span><span class="plain-syntax"> *</span><span class="function-syntax">AdjectiveMeanings::make_schema</span><span class="plain-syntax">(</span><span class="reserved-syntax">adjective_meaning</span><span class="plain-syntax"> *</span><span class="identifier-syntax">am</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">T</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">kind</span><span class="plain-syntax"> *</span><span class="identifier-syntax">K</span><span class="plain-syntax"> = </span><a href="8-amd.html#SP7" class="function-link"><span class="function-syntax">AdjectiveMeaningDomains::get_kind</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">am</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">K</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="identifier-syntax">K</span><span class="plain-syntax"> = </span><span class="identifier-syntax">K_object</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">via_support</span><span class="plain-syntax"> = </span><span class="constant-syntax">DIRECT_TASKMODE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Kinds::Behaviour::is_object</span><span class="plain-syntax">(</span><span class="identifier-syntax">K</span><span class="plain-syntax">)) </span><span class="identifier-syntax">via_support</span><span class="plain-syntax"> = </span><span class="constant-syntax">VIA_SUPPORT_FUNCTION_TASKMODE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">am</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">task_data</span><span class="plain-syntax">[</span><span class="identifier-syntax">T</span><span class="plain-syntax">].</span><span class="element-syntax">task_mode</span><span class="plain-syntax"> = </span><span class="identifier-syntax">via_support</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> &amp;(</span><span class="identifier-syntax">am</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">task_data</span><span class="plain-syntax">[</span><span class="identifier-syntax">T</span><span class="plain-syntax">].</span><span class="element-syntax">code_to_perform</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">AdjectiveMeanings::perform_task_via_function</span><button class="popup" onclick="togglePopup('usagePopup7')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup7">Usage of <span class="code-font"><span class="function-syntax">AdjectiveMeanings::perform_task_via_function</span></span>:<br/>Adjectives by Phrase - <a href="8-abp.html#SP1">&#167;1</a><br/>Adjectives by Condition - <a href="8-abc.html#SP2">&#167;2</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">adjective_meaning</span><span class="plain-syntax"> *</span><span class="identifier-syntax">am</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">T</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">am</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">task_data</span><span class="plain-syntax">[</span><span class="identifier-syntax">T</span><span class="plain-syntax">].</span><span class="element-syntax">task_mode</span><span class="plain-syntax"> = </span><span class="constant-syntax">VIA_SUPPORT_FUNCTION_TASKMODE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP7" class="paragraph-anchor"></a><b>&#167;7. </b>And this function reads it back, automatically generating the function call
schema if it's needed.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="identifier-syntax">i6_schema</span><span class="plain-syntax"> *</span><span class="function-syntax">AdjectiveMeanings::get_schema</span><button class="popup" onclick="togglePopup('usagePopup8')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup8">Usage of <span class="code-font"><span class="function-syntax">AdjectiveMeanings::get_schema</span></span>:<br/>Adjective Ambiguity - <a href="8-aa.html#SP9">&#167;9</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">adjective_meaning</span><span class="plain-syntax"> *</span><span class="identifier-syntax">am</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">T</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><a href="8-am.html#SP11" class="function-link"><span class="function-syntax">AdjectiveMeanings::prepare_schemas</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">am</span><span class="plain-syntax">, </span><span class="identifier-syntax">T</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">switch</span><span class="plain-syntax"> (</span><span class="identifier-syntax">am</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">task_data</span><span class="plain-syntax">[</span><span class="identifier-syntax">T</span><span class="plain-syntax">].</span><span class="element-syntax">task_mode</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">DIRECT_TASKMODE:</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">return</span><span class="plain-syntax"> &amp;(</span><span class="identifier-syntax">am</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">task_data</span><span class="plain-syntax">[</span><span class="identifier-syntax">T</span><span class="plain-syntax">].</span><span class="element-syntax">code_to_perform</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">VIA_SUPPORT_FUNCTION_TASKMODE:</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Calculus::Schemas::empty</span><span class="plain-syntax">(&amp;(</span><span class="identifier-syntax">am</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">task_data</span><span class="plain-syntax">[</span><span class="identifier-syntax">T</span><span class="plain-syntax">].</span><span class="element-syntax">call_to_support_function</span><span class="plain-syntax">)))</span>
<span class="plain-syntax">                </span><span class="named-paragraph-container code-font"><a href="8-am.html#SP7_1" class="named-paragraph-link"><span class="named-paragraph">Construct a schema for calling the support function</span><span class="named-paragraph-number">7.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">return</span><span class="plain-syntax"> &amp;(</span><span class="identifier-syntax">am</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">task_data</span><span class="plain-syntax">[</span><span class="identifier-syntax">T</span><span class="plain-syntax">].</span><span class="element-syntax">call_to_support_function</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>

<span class="identifier-syntax">i6_schema</span><span class="plain-syntax"> *</span><span class="function-syntax">AdjectiveMeanings::get_schema_without_call</span><button class="popup" onclick="togglePopup('usagePopup9')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup9">Usage of <span class="code-font"><span class="function-syntax">AdjectiveMeanings::get_schema_without_call</span></span>:<br/><a href="8-am.html#SP13_1">&#167;13.1</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">adjective_meaning</span><span class="plain-syntax"> *</span><span class="identifier-syntax">am</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">T</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><a href="8-am.html#SP11" class="function-link"><span class="function-syntax">AdjectiveMeanings::prepare_schemas</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">am</span><span class="plain-syntax">, </span><span class="identifier-syntax">T</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">switch</span><span class="plain-syntax"> (</span><span class="identifier-syntax">am</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">task_data</span><span class="plain-syntax">[</span><span class="identifier-syntax">T</span><span class="plain-syntax">].</span><span class="element-syntax">task_mode</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">DIRECT_TASKMODE:</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">VIA_SUPPORT_FUNCTION_TASKMODE:</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">return</span><span class="plain-syntax"> &amp;(</span><span class="identifier-syntax">am</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">task_data</span><span class="plain-syntax">[</span><span class="identifier-syntax">T</span><span class="plain-syntax">].</span><span class="element-syntax">code_to_perform</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP7_1" class="paragraph-anchor"></a><b>&#167;7.1. </b>Where the following is complicated by the need to respect negations; it may
be that the original adjective has a support routine defined, but that the
negation does not, and so must use those of the original.
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Construct a schema for calling the support function</span><span class="named-paragraph-number">7.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">task</span><span class="plain-syntax"> = </span><span class="identifier-syntax">T</span><span class="plain-syntax">; </span><span class="reserved-syntax">char</span><span class="plain-syntax"> *</span><span class="identifier-syntax">negation_operator</span><span class="plain-syntax"> = </span><span class="string-syntax">""</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">adjective</span><span class="plain-syntax"> *</span><span class="identifier-syntax">use_adj</span><span class="plain-syntax"> = </span><span class="identifier-syntax">am</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">owning_adjective</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">am</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">negated_from</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">use_adj</span><span class="plain-syntax"> = </span><span class="identifier-syntax">am</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">negated_from</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">owning_adjective</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">switch</span><span class="plain-syntax"> (</span><span class="identifier-syntax">T</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">TEST_ATOM_TASK:</span><span class="plain-syntax"> </span><span class="identifier-syntax">negation_operator</span><span class="plain-syntax"> = </span><span class="string-syntax">"~~"</span><span class="plain-syntax">; </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">NOW_ATOM_TRUE_TASK:</span><span class="plain-syntax"> </span><span class="identifier-syntax">task</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NOW_ATOM_FALSE_TASK</span><span class="plain-syntax">; </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">NOW_ATOM_FALSE_TASK:</span><span class="plain-syntax"> </span><span class="identifier-syntax">task</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NOW_ATOM_TRUE_TASK</span><span class="plain-syntax">; </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">inter_name</span><span class="plain-syntax"> *</span><span class="identifier-syntax">iname</span><span class="plain-syntax"> = </span><span class="identifier-syntax">RTAdjectives::task_fn_iname</span><span class="plain-syntax">(</span><span class="identifier-syntax">use_adj</span><span class="plain-syntax">, </span><span class="identifier-syntax">task</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><a href="8-amd.html#SP7" class="function-link"><span class="function-syntax">AdjectiveMeaningDomains::get_kind</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">am</span><span class="plain-syntax">));</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">Calculus::Schemas::modify</span><span class="plain-syntax">(&amp;(</span><span class="identifier-syntax">am</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">task_data</span><span class="plain-syntax">[</span><span class="identifier-syntax">T</span><span class="plain-syntax">].</span><span class="element-syntax">call_to_support_function</span><span class="plain-syntax">),</span>
<span class="plain-syntax">        </span><span class="string-syntax">"*=-(%s%n(*1))"</span><span class="plain-syntax">, </span><span class="identifier-syntax">negation_operator</span><span class="plain-syntax">, </span><span class="identifier-syntax">iname</span><span class="plain-syntax">);</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="8-am.html#SP7">&#167;7</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP8" class="paragraph-anchor"></a><b>&#167;8. Families of adjective meanings.</b>The above API would allow us to make fairly arbitrary one-off adjectives,
but in practice we have a number of distinct purposes and want to make a
whole pile of related adjectives for each one. So we actually create
adjective meanings in "families".
</p>

<p class="commentary">Each family is represented by an instance of the following:
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">typedef</span><span class="plain-syntax"> </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">adjective_meaning_family</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">method_set</span><span class="plain-syntax"> *</span><span class="identifier-syntax">methods</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">definition_claim_priority</span><span class="plain-syntax">; </span><span class="comment-syntax"> 0 to 9: lower is better</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">CLASS_DEFINITION</span>
<span class="plain-syntax">} </span><span class="reserved-syntax">adjective_meaning_family</span><span class="plain-syntax">;</span>

<span class="reserved-syntax">adjective_meaning_family</span><span class="plain-syntax"> *</span><span class="function-syntax">AdjectiveMeanings::new_family</span><button class="popup" onclick="togglePopup('usagePopup10')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup10">Usage of <span class="code-font"><span class="function-syntax">AdjectiveMeanings::new_family</span></span>:<br/>Adjectives by Phrase - <a href="8-abp.html#SP1">&#167;1</a><br/>Adjectives by Condition - <a href="8-abc.html#SP1">&#167;1</a><br/>Adjectives by Inter Function - <a href="8-abif.html#SP2">&#167;2</a><br/>Adjectives by Inter Condition - <a href="8-abic.html#SP2">&#167;2</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">N</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">adjective_meaning_family</span><span class="plain-syntax"> *</span><span class="identifier-syntax">f</span><span class="plain-syntax"> = </span><span class="identifier-syntax">CREATE</span><span class="plain-syntax">(</span><span class="reserved-syntax">adjective_meaning_family</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">f</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">definition_claim_priority</span><span class="plain-syntax"> = </span><span class="identifier-syntax">N</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">f</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">methods</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Methods::new_set</span><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">f</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<ul class="endnotetexts"><li>The structure adjective_meaning_family is accessed in 5/idf and here.</li></ul>
<p class="commentary firstcommentary"><a id="SP9" class="paragraph-anchor"></a><b>&#167;9. </b>Families provide a number of methods to tweak how adjectives behave,
and here goes. All of these methods are optional.
</p>

<p class="commentary"><span class="extract"><span class="extract-syntax">CLAIM_DEFINITION_SENTENCE_ADJM_MTID</span></span> is an opportunity to say that a
definition in the source text is asking for this kind of adjective.
Suppose the source has a line like so:
</p>

<blockquote>
    <p>Definition: A ... (called ...) is ... if ...</p>
</blockquote>

<p class="commentary">In place of the ellipses are respectively <span class="extract"><span class="extract-syntax">DNW</span></span> (domain wording), <span class="extract"><span class="extract-syntax">CALLW</span></span>
(the calling), <span class="extract"><span class="extract-syntax">AW</span></span> (the adjective) and <span class="extract"><span class="extract-syntax">CONW</span></span> (the condition). <span class="extract"><span class="extract-syntax">sense</span></span> is
either 1, meaning that "if" was used (the condition has positive sense);
or -1, meaning that it was "unless" (a negative sense); or 0, meaning
that instead of a condition, a rule was supplied.
</p>

<p class="commentary">If the method is provided, it should look at these and decide if this is
the sort of adjective it wants to make. If so, it should return <span class="extract"><span class="extract-syntax">TRUE</span></span>
and copy a pointer to the new adjective meaning into <span class="extract"><span class="extract-syntax">result</span></span>. If not,
it should return <span class="extract"><span class="extract-syntax">FALSE</span></span>.
</p>

<p class="commentary">Of course, only one family can take the prize, and so the sequence in which
the families are offered the chance to claim is significant. This sequence
is ascending order of the family's <span class="extract"><span class="extract-syntax">definition_claim_priority</span></span> field.
</p>

<pre class="definitions code-font"><span class="definition-keyword">enum</span> <span class="constant-syntax">CLAIM_DEFINITION_SENTENCE_ADJM_MTID</span>
</pre>
<pre class="displayed-code all-displayed-code code-font">
<span class="identifier-syntax">INT_METHOD_TYPE</span><span class="plain-syntax">(</span><span class="constant-syntax">CLAIM_DEFINITION_SENTENCE_ADJM_MTID</span><span class="plain-syntax">, </span><span class="reserved-syntax">adjective_meaning_family</span><span class="plain-syntax"> *</span><span class="identifier-syntax">f</span><span class="plain-syntax">,</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">adjective_meaning</span><span class="plain-syntax"> **</span><span class="identifier-syntax">result</span><span class="plain-syntax">, </span><span class="identifier-syntax">parse_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">q</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">sense</span><span class="plain-syntax">,</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">wording</span><span class="plain-syntax"> </span><span class="identifier-syntax">AW</span><span class="plain-syntax">, </span><span class="identifier-syntax">wording</span><span class="plain-syntax"> </span><span class="identifier-syntax">DNW</span><span class="plain-syntax">, </span><span class="identifier-syntax">wording</span><span class="plain-syntax"> </span><span class="identifier-syntax">CONW</span><span class="plain-syntax">, </span><span class="identifier-syntax">wording</span><span class="plain-syntax"> </span><span class="identifier-syntax">CALLW</span><span class="plain-syntax">)</span>

<span class="reserved-syntax">adjective_meaning</span><span class="plain-syntax"> *</span><span class="function-syntax">AdjectiveMeanings::claim_definition</span><button class="popup" onclick="togglePopup('usagePopup11')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup11">Usage of <span class="code-font"><span class="function-syntax">AdjectiveMeanings::claim_definition</span></span>:<br/>Adjectival Definition Family - <a href="5-adf.html#SP9_3">&#167;9.3</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">parse_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">q</span><span class="plain-syntax">,</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">sense</span><span class="plain-syntax">, </span><span class="identifier-syntax">wording</span><span class="plain-syntax"> </span><span class="identifier-syntax">AW</span><span class="plain-syntax">, </span><span class="identifier-syntax">wording</span><span class="plain-syntax"> </span><span class="identifier-syntax">DNW</span><span class="plain-syntax">, </span><span class="identifier-syntax">wording</span><span class="plain-syntax"> </span><span class="identifier-syntax">CONW</span><span class="plain-syntax">, </span><span class="identifier-syntax">wording</span><span class="plain-syntax"> </span><span class="identifier-syntax">CALLW</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">priority</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">; </span><span class="identifier-syntax">priority</span><span class="plain-syntax"> &lt; </span><span class="constant-syntax">10</span><span class="plain-syntax">; </span><span class="identifier-syntax">priority</span><span class="plain-syntax">++) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">adjective_meaning_family</span><span class="plain-syntax"> *</span><span class="identifier-syntax">f</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">LOOP_OVER</span><span class="plain-syntax">(</span><span class="identifier-syntax">f</span><span class="plain-syntax">, </span><span class="reserved-syntax">adjective_meaning_family</span><span class="plain-syntax">)</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">f</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">definition_claim_priority</span><span class="plain-syntax"> == </span><span class="identifier-syntax">priority</span><span class="plain-syntax">)</span>
<span class="plain-syntax">                </span><span class="named-paragraph-container code-font"><a href="8-am.html#SP9_1" class="named-paragraph-link"><span class="named-paragraph">Try the f family</span><span class="named-paragraph-number">9.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP9_1" class="paragraph-anchor"></a><b>&#167;9.1. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Try the f family</span><span class="named-paragraph-number">9.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">adjective_meaning</span><span class="plain-syntax"> *</span><span class="identifier-syntax">am</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">rv</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">INT_METHOD_CALL</span><span class="plain-syntax">(</span><span class="identifier-syntax">rv</span><span class="plain-syntax">, </span><span class="identifier-syntax">f</span><span class="plain-syntax">, </span><span class="constant-syntax">CLAIM_DEFINITION_SENTENCE_ADJM_MTID</span><span class="plain-syntax">, &amp;</span><span class="identifier-syntax">am</span><span class="plain-syntax">, </span><span class="identifier-syntax">q</span><span class="plain-syntax">, </span><span class="identifier-syntax">sense</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">AW</span><span class="plain-syntax">, </span><span class="identifier-syntax">DNW</span><span class="plain-syntax">, </span><span class="identifier-syntax">CONW</span><span class="plain-syntax">, </span><span class="identifier-syntax">CALLW</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">rv</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">am</span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="8-am.html#SP9">&#167;9</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP10" class="paragraph-anchor"></a><b>&#167;10. </b>By default, an adjective meaning cannot be asserted, that is, said to be
true of something (an inference subject) in the model world. So if "fizzy"
is a newly created adjective, the sentence "The drink is fizzy" would be
rejected. But if the family for "fizzy" provides an <span class="extract"><span class="extract-syntax">ASSERT_ADJM_MTID</span></span> method,
it's a different matter. The method should either return <span class="extract"><span class="extract-syntax">FALSE</span></span> to decline
after all, or draw some inferences and then return <span class="extract"><span class="extract-syntax">TRUE</span></span>.
</p>

<p class="commentary"><span class="extract"><span class="extract-syntax">parity</span></span> is <span class="extract"><span class="extract-syntax">TRUE</span></span> if the assertion claims the meaning <span class="extract"><span class="extract-syntax">am</span></span> is true about the
subject <span class="extract"><span class="extract-syntax">subj</span></span>, and otherwise <span class="extract"><span class="extract-syntax">FALSE</span></span>.
</p>

<pre class="definitions code-font"><span class="definition-keyword">enum</span> <span class="constant-syntax">ASSERT_ADJM_MTID</span>
</pre>
<pre class="displayed-code all-displayed-code code-font">
<span class="identifier-syntax">INT_METHOD_TYPE</span><span class="plain-syntax">(</span><span class="constant-syntax">ASSERT_ADJM_MTID</span><span class="plain-syntax">, </span><span class="reserved-syntax">adjective_meaning_family</span><span class="plain-syntax"> *</span><span class="identifier-syntax">f</span><span class="plain-syntax">, </span><span class="reserved-syntax">adjective_meaning</span><span class="plain-syntax"> *</span><span class="identifier-syntax">am</span><span class="plain-syntax">,</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">inference_subject</span><span class="plain-syntax"> *</span><span class="identifier-syntax">subj</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">parity</span><span class="plain-syntax">)</span>

<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">AdjectiveMeanings::assert</span><button class="popup" onclick="togglePopup('usagePopup12')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup12">Usage of <span class="code-font"><span class="function-syntax">AdjectiveMeanings::assert</span></span>:<br/>Adjective Ambiguity - <a href="8-aa.html#SP8">&#167;8</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">adjective_meaning</span><span class="plain-syntax"> *</span><span class="identifier-syntax">am</span><span class="plain-syntax">, </span><span class="identifier-syntax">inference_subject</span><span class="plain-syntax"> *</span><span class="identifier-syntax">subj</span><span class="plain-syntax">,</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">parity</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">am</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">negated_from</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">am</span><span class="plain-syntax"> = </span><span class="identifier-syntax">am</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">negated_from</span><span class="plain-syntax">; </span><span class="identifier-syntax">parity</span><span class="plain-syntax"> = (</span><span class="identifier-syntax">parity</span><span class="plain-syntax">)?</span><span class="identifier-syntax">FALSE:TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">rv</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">INT_METHOD_CALL</span><span class="plain-syntax">(</span><span class="identifier-syntax">rv</span><span class="plain-syntax">, </span><span class="identifier-syntax">am</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">family</span><span class="plain-syntax">, </span><span class="constant-syntax">ASSERT_ADJM_MTID</span><span class="plain-syntax">, </span><span class="identifier-syntax">am</span><span class="plain-syntax">, </span><span class="identifier-syntax">subj</span><span class="plain-syntax">, </span><span class="identifier-syntax">parity</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">rv</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP11" class="paragraph-anchor"></a><b>&#167;11. </b>Next, <span class="extract"><span class="extract-syntax">PREPARE_SCHEMAS_ADJM_MTID</span></span>. Just before code is about to be
generated for the adjective to perform some task, this method is called.
The idea is that this is an opportunity to compile a schema for the adjective
at the last minute (as an alternative to having set the schemas up at
creation time), but there is no obligation.
</p>

<pre class="definitions code-font"><span class="definition-keyword">enum</span> <span class="constant-syntax">PREPARE_SCHEMAS_ADJM_MTID</span>
</pre>
<pre class="displayed-code all-displayed-code code-font">
<span class="identifier-syntax">VOID_METHOD_TYPE</span><span class="plain-syntax">(</span><span class="constant-syntax">PREPARE_SCHEMAS_ADJM_MTID</span><span class="plain-syntax">, </span><span class="reserved-syntax">adjective_meaning_family</span><span class="plain-syntax"> *</span><span class="identifier-syntax">f</span><span class="plain-syntax">,</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">adjective_meaning</span><span class="plain-syntax"> *</span><span class="identifier-syntax">am</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">task</span><span class="plain-syntax">)</span>

<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">AdjectiveMeanings::prepare_schemas</span><button class="popup" onclick="togglePopup('usagePopup13')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup13">Usage of <span class="code-font"><span class="function-syntax">AdjectiveMeanings::prepare_schemas</span></span>:<br/><a href="8-am.html#SP7">&#167;7</a>, <a href="8-am.html#SP13">&#167;13</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">adjective_meaning</span><span class="plain-syntax"> *</span><span class="identifier-syntax">am</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">task</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">VOID_METHOD_CALL</span><span class="plain-syntax">(</span><span class="identifier-syntax">am</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">family</span><span class="plain-syntax">, </span><span class="constant-syntax">PREPARE_SCHEMAS_ADJM_MTID</span><span class="plain-syntax">, </span><span class="identifier-syntax">am</span><span class="plain-syntax">, </span><span class="identifier-syntax">task</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">am</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">schemas_prepared</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP12" class="paragraph-anchor"></a><b>&#167;12. </b><span class="extract"><span class="extract-syntax">GENERATE_IN_SUPPORT_FUNCTION_ADJM_MTID</span></span> offers a way to bypass the usual code
generation process. It is called on only when <a href="../runtime-module/5-adj.html" class="internal">Adjectives (in runtime)</a> is
compiling a support function &mdash; and therefore it will never be called on if
the adjective doesn't perform this task with a support function; see above.
</p>

<p class="commentary">It is called twice, first with <span class="extract"><span class="extract-syntax">emit_flag</span></span> set to <span class="extract"><span class="extract-syntax">FALSE</span></span>; it should do nothing,
but return <span class="extract"><span class="extract-syntax">TRUE</span></span> to indicate that it wants to generate wacky code of its own.
On the second call, <span class="extract"><span class="extract-syntax">emit_flag</span></span> will be <span class="extract"><span class="extract-syntax">TRUE</span></span>, and this time the method should
follow through on its earlier promise.
</p>

<p class="commentary">If the method is not provided or returns <span class="extract"><span class="extract-syntax">FALSE</span></span>, then the code will be generated
from the schema in the normal way.
</p>

<p class="commentary">As with schemas, <span class="extract"><span class="extract-syntax">T</span></span> is the task to be performed.
</p>

<p class="commentary">If <span class="extract"><span class="extract-syntax">emit_flag</span></span> is <span class="extract"><span class="extract-syntax">TRUE</span></span>, then code should actually be generated, and within
the given stack frame. If it is <span class="extract"><span class="extract-syntax">FALSE</span></span>, the function should simply return
whether it is able to do this or not.
</p>

<pre class="definitions code-font"><span class="definition-keyword">enum</span> <span class="constant-syntax">GENERATE_IN_SUPPORT_FUNCTION_ADJM_MTID</span>
</pre>
<pre class="displayed-code all-displayed-code code-font">
<span class="identifier-syntax">INT_METHOD_TYPE</span><span class="plain-syntax">(</span><span class="constant-syntax">GENERATE_IN_SUPPORT_FUNCTION_ADJM_MTID</span><span class="plain-syntax">, </span><span class="reserved-syntax">adjective_meaning_family</span><span class="plain-syntax"> *</span><span class="identifier-syntax">f</span><span class="plain-syntax">,</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">adjective_meaning</span><span class="plain-syntax"> *</span><span class="identifier-syntax">am</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">T</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">emit_flag</span><span class="plain-syntax">, </span><span class="identifier-syntax">stack_frame</span><span class="plain-syntax"> *</span><span class="identifier-syntax">phsf</span><span class="plain-syntax">)</span>
</pre>
<p class="commentary firstcommentary"><a id="SP13" class="paragraph-anchor"></a><b>&#167;13. </b>This dual behaviour means there are two function calls invoking it:
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">AdjectiveMeanings::generate_in_support_function</span><span class="plain-syntax">(</span><span class="reserved-syntax">adjective_meaning</span><span class="plain-syntax"> *</span><span class="identifier-syntax">am</span><span class="plain-syntax">,</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">T</span><span class="plain-syntax">, </span><span class="identifier-syntax">stack_frame</span><span class="plain-syntax"> *</span><span class="identifier-syntax">phsf</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">rv</span><span class="plain-syntax"> = </span><a href="8-am.html#SP13" class="function-link"><span class="function-syntax">AdjectiveMeanings::nscg_inner</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">am</span><span class="plain-syntax">, </span><span class="identifier-syntax">T</span><span class="plain-syntax">, </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">, </span><span class="identifier-syntax">phsf</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">am</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">has_been_compiled_in_support_function</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">rv</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">AdjectiveMeanings::can_generate_in_support_function</span><span class="plain-syntax">(</span><span class="reserved-syntax">adjective_meaning</span><span class="plain-syntax"> *</span><span class="identifier-syntax">am</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">T</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><a href="8-am.html#SP13" class="function-link"><span class="function-syntax">AdjectiveMeanings::nscg_inner</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">am</span><span class="plain-syntax">, </span><span class="identifier-syntax">T</span><span class="plain-syntax">, </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">, </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">AdjectiveMeanings::nscg_inner</span><span class="plain-syntax">(</span><span class="reserved-syntax">adjective_meaning</span><span class="plain-syntax"> *</span><span class="identifier-syntax">am</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">T</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">emit_flag</span><span class="plain-syntax">,</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">stack_frame</span><span class="plain-syntax"> *</span><span class="identifier-syntax">phsf</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><a href="8-am.html#SP11" class="function-link"><span class="function-syntax">AdjectiveMeanings::prepare_schemas</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">am</span><span class="plain-syntax">, </span><span class="identifier-syntax">T</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="8-am.html#SP13_1" class="named-paragraph-link"><span class="named-paragraph">Use the I6 schema instead to compile the task, if one exists</span><span class="named-paragraph-number">13.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">rv</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">INT_METHOD_CALL</span><span class="plain-syntax">(</span><span class="identifier-syntax">rv</span><span class="plain-syntax">, </span><span class="identifier-syntax">am</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">family</span><span class="plain-syntax">, </span><span class="constant-syntax">GENERATE_IN_SUPPORT_FUNCTION_ADJM_MTID</span><span class="plain-syntax">, </span><span class="identifier-syntax">am</span><span class="plain-syntax">, </span><span class="identifier-syntax">T</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">emit_flag</span><span class="plain-syntax">, </span><span class="identifier-syntax">phsf</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">rv</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP13_1" class="paragraph-anchor"></a><b>&#167;13.1. </b>Because we are inside the support function, we need to call
<a href="8-am.html#SP7" class="internal">AdjectiveMeanings::get_schema_without_call</a> not <a href="8-am.html#SP7" class="internal">AdjectiveMeanings::get_schema</a> &mdash;
otherwise, we would be given the schema for a function call to the very thing
we are now trying to compile, and the result would be code which recursed
forever.
</p>

<p class="commentary">The stack frame for the support function has a single variable "it" as number 0,
and we set <span class="extract"><span class="extract-syntax">*1</span></span> to be this parameter. This is in fact the term we are performing
the task on. <span class="extract"><span class="extract-syntax">*2</span></span> is unset.
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Use the I6 schema instead to compile the task, if one exists</span><span class="named-paragraph-number">13.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">i6_schema</span><span class="plain-syntax"> *</span><span class="identifier-syntax">sch</span><span class="plain-syntax"> = </span><a href="8-am.html#SP7" class="function-link"><span class="function-syntax">AdjectiveMeanings::get_schema_without_call</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">am</span><span class="plain-syntax">, </span><span class="identifier-syntax">T</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Calculus::Schemas::empty</span><span class="plain-syntax">(</span><span class="identifier-syntax">sch</span><span class="plain-syntax">) == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">emit_flag</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">parse_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">it_var</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Lvalues::new_LOCAL_VARIABLE</span><span class="plain-syntax">(</span><span class="identifier-syntax">EMPTY_WORDING</span><span class="plain-syntax">,</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">LocalVariables::it_variable</span><span class="plain-syntax">());</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">pcalc_term</span><span class="plain-syntax"> </span><span class="identifier-syntax">it_term</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Terms::new_constant</span><span class="plain-syntax">(</span><span class="identifier-syntax">it_var</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">CompileSchemas::from_terms_in_val_context</span><span class="plain-syntax">(</span><span class="identifier-syntax">sch</span><span class="plain-syntax">, &amp;</span><span class="identifier-syntax">it_term</span><span class="plain-syntax">, </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="8-am.html#SP13">&#167;13</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP14" class="paragraph-anchor"></a><b>&#167;14. </b>At last, something simpler. <span class="extract"><span class="extract-syntax">INDEX_ADJM_MTID</span></span>, if provided, should print
a description suitable for use in the lexicon part of the index, and return
<span class="extract"><span class="extract-syntax">TRUE</span></span>. If not provided, or it returns <span class="extract"><span class="extract-syntax">FALSE</span></span>, something sensible is done
instead; this is only an opportunity to improve the wording.
</p>

<p class="commentary">Note that this is only called for the positive sense of an adjective meaning,
not for one which is the negated form of another.
</p>

<pre class="definitions code-font"><span class="definition-keyword">enum</span> <span class="constant-syntax">INDEX_ADJM_MTID</span>
</pre>
<pre class="displayed-code all-displayed-code code-font">
<span class="identifier-syntax">INT_METHOD_TYPE</span><span class="plain-syntax">(</span><span class="constant-syntax">INDEX_ADJM_MTID</span><span class="plain-syntax">, </span><span class="reserved-syntax">adjective_meaning_family</span><span class="plain-syntax"> *</span><span class="identifier-syntax">f</span><span class="plain-syntax">, </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">,</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">adjective_meaning</span><span class="plain-syntax"> *</span><span class="identifier-syntax">am</span><span class="plain-syntax">)</span>

<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">AdjectiveMeanings::nonstandard_index_entry</span><span class="plain-syntax">(</span><span class="identifier-syntax">OUTPUT_STREAM</span><span class="plain-syntax">, </span><span class="reserved-syntax">adjective_meaning</span><span class="plain-syntax"> *</span><span class="identifier-syntax">am</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">rv</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">INT_METHOD_CALL</span><span class="plain-syntax">(</span><span class="identifier-syntax">rv</span><span class="plain-syntax">, </span><span class="identifier-syntax">am</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">family</span><span class="plain-syntax">, </span><span class="constant-syntax">INDEX_ADJM_MTID</span><span class="plain-syntax">, </span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">am</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">rv</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<nav role="progress"><div class="progresscontainer">
    <ul class="progressbar"><li class="progressprev"><a href="8-aa.html">&#10094;</a></li><li class="progresschapter"><a href="P-wtmd.html">P</a></li><li class="progresschapter"><a href="1-am.html">1</a></li><li class="progresschapter"><a href="2-bv.html">2</a></li><li class="progresschapter"><a href="3-dlr.html">3</a></li><li class="progresschapter"><a href="4-nr.html">4</a></li><li class="progresschapter"><a href="5-id.html">5</a></li><li class="progresschapter"><a href="6-rls.html">6</a></li><li class="progresschapter"><a href="7-tc.html">7</a></li><li class="progresscurrentchapter">8</li><li class="progresssection"><a href="8-kpr.html">kpr</a></li><li class="progresssection"><a href="8-tap.html">tap</a></li><li class="progresssection"><a href="8-tcp.html">tcp</a></li><li class="progresssection"><a href="8-terr.html">terr</a></li><li class="progresssection"><a href="8-qr.html">qr</a></li><li class="progresssection"><a href="8-tur.html">tur</a></li><li class="progresssection"><a href="8-er.html">er</a></li><li class="progresssection"><a href="8-lr.html">lr</a></li><li class="progresssection"><a href="8-aa.html">aa</a></li><li class="progresscurrent">am</li><li class="progresssection"><a href="8-amd.html">amd</a></li><li class="progresssection"><a href="8-abp.html">abp</a></li><li class="progresssection"><a href="8-abc.html">abc</a></li><li class="progresssection"><a href="8-abif.html">abif</a></li><li class="progresssection"><a href="8-abic.html">abic</a></li><li class="progresssection"><a href="8-cu.html">cu</a></li><li class="progressnext"><a href="8-amd.html">&#10095;</a></li></ul></div>
</nav><!-- End of weave -->

		</main>
	</body>
</html>

